package config

import (
	"encoding/json"
	"os"
)

type CrawlerConf struct {
	Crawl_url  string
	Crawl_func string
	Worker_num int
}

// 配置文件
const filename = "config/crawler_conf.json"

func GetCrawlerConf() CrawlerConf {
	file, err := os.Open(filename)
	defer file.Close()
	if err != nil {
		panic(err)
	}

	decoder := json.NewDecoder(file)
	conf := CrawlerConf{}
	err = decoder.Decode(&conf)
	if err != nil {
		panic(err)
	}

	return conf
}
